#include "tess.h"

#include "TessOCR.h"
#pragma comment(lib, "tessdll.lib")
#pragma comment(lib, "Ws2_32.lib")

#include <string>
using namespace std;

bool Recognize(
		const char*		lpLanguage,		/*e.g. eng, chs, null means eng*/
		bool			numeric_mode,
		const unsigned char* buffer,	/*image buffer*/
		int				bytes_per_pixel,
		int				bytes_per_line,
		int				left, 
		int				top,
		int				width, 
		int				height,
		char*			lpText,			/*output text buffer*/
		int				nSize			/*maximize size*/
		)
{
	TessOCR engine;
	string s = engine.Recognize(
		"tess",
		lpLanguage,
		numeric_mode,
		buffer,
		bytes_per_pixel,
		bytes_per_line,
		left,
		top,
		width,
		height);

	strcpy_s(lpText, nSize, s.c_str());
	return true;
}